package main

import "fmt"

func main() {

	add := address{province: "2", city: "4"}
	p := person{name: "飞雪无情", age: 30, addr: add}
	fmt.Println(p.name, p.age, p.addr)
	printString(p)
	printString(p.addr)
}

type person struct {
	name string
	age  uint
	addr address
}

type structName struct {
	fieldName string
}
type address struct {
	province string
	city     string
}

func printString(s fmt.Stringer) {
	fmt.Println(s.String())
}
func (p person) String() string {
	return fmt.Sprintf("the name is %s,age is %d", p.age, "****", p.age)
}

func (addr address) String() string {
	return fmt.Sprintf("the addr is %s%s", addr.province, "****", addr.city)
}

type Stringer interface {
	String() string
}
